/*! @file binaryviewwidget.h
  * @brief Definition of BinaryViewWidget Class
  * Widget to show hex view of db in tabWdiget
  * @author AK
  * @date 08.10.2012
  */


#ifndef BINARYVIEWWIDGET_H
#define BINARYVIEWWIDGET_H

//#include "ui_binaryViewWidget.h"
#include "ui_binaryviewwidget.h"
#include "defines.h"
#include "parsethread.h"

#include <QWidget>
#include <QFile>

class ParseThread;

/**
 * @brief BinaryViewWidget Class Definition
 *
 * @class BinaryViewWidget binaryviewwidget.h "PlacesParser/binaryviewwidget.h"
 */
class BinaryViewWidget : public QWidget,
        public Ui::binaryViewWidget
{
    Q_OBJECT

public:
    BinaryViewWidget(int i, QString lpath, QWidget *parent = 0);
    QFile *file;

public Q_SLOTS:
    int openFile();
    int parseFile();
    void updateProgressBar(int);

Q_SIGNALS:
    void closeMe(int idx);      // sent to MainWindow to close tab(idx)
    void fileOpened();
    void fileParsed();
    void parsingCanceled();
    void writeMe(QString);

private:
    bool empty;
    bool filterEmpty;
    int idx;                    // tab index
    QByteArray blob;
    int bytecount;
    int bytesperline;
    int columncount;
    long linecount;
    QTime t;
    ParseThread* worker;

private Q_SLOTS:
    void closeTab();            // on readyBtn clicked close this tab
    void filterEmptyLines();
    void on_cancelPushButtonClicked();
    void parsingFinished();
    void setBytesWidth();
    void writePage(QString);
};

#endif // BINARYVIEWWIDGET_H
